import React, { Component } from "react";
import { withRouter } from "react-router-dom";
import PropTypes from "prop-types";
import "./index.scss";

class Card extends Component {
  render() {
    const { link, title, description } = this.props;
    return (
      <div
        className="card"
        onClick={() => {
          this.props.history.push(link);
        }}
      >
        <p className="title">{title}</p>
        <p className="description">{description}</p>
      </div>
    );
  }
}

Card.propTypes = {
  link: PropTypes.string,
  title: PropTypes.string,
  description: PropTypes.string,
};

export default withRouter(Card);
